Skip to main content
POST
/
v1
/
customers
/
{id}
/
credits
Create credit product
curl --request POST \
  --url https://api.hyperline.co/v1/customers/{id}/credits \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "product_id": "itm_3kXODDF42QXtnL",
  "name": "Credit name",
  "current_balance": 2000,
  "low_count_threshold": 10
}
'
import requests

url = "https://api.hyperline.co/v1/customers/{id}/credits"

payload = {
"product_id": "itm_3kXODDF42QXtnL",
"name": "Credit name",
"current_balance": 2000,
"low_count_threshold": 10
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
product_id: 'itm_3kXODDF42QXtnL',
name: 'Credit name',
current_balance: 2000,
low_count_threshold: 10
})
};

fetch('https://api.hyperline.co/v1/customers/{id}/credits', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.hyperline.co/v1/customers/{id}/credits",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'product_id' => 'itm_3kXODDF42QXtnL',
'name' => 'Credit name',
'current_balance' => 2000,
'low_count_threshold' => 10
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.hyperline.co/v1/customers/{id}/credits"

payload := strings.NewReader("{\n \"product_id\": \"itm_3kXODDF42QXtnL\",\n \"name\": \"Credit name\",\n \"current_balance\": 2000,\n \"low_count_threshold\": 10\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.hyperline.co/v1/customers/{id}/credits")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"product_id\": \"itm_3kXODDF42QXtnL\",\n \"name\": \"Credit name\",\n \"current_balance\": 2000,\n \"low_count_threshold\": 10\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.hyperline.co/v1/customers/{id}/credits")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"product_id\": \"itm_3kXODDF42QXtnL\",\n \"name\": \"Credit name\",\n \"current_balance\": 2000,\n \"low_count_threshold\": 10\n}"

response = http.request(request)
puts response.read_body
{
  "product_id": "itm_3kXODDF42QXtnL",
  "customer_id": "cus_Typ0px2W0aiEtl",
  "name": "Credit name",
  "current_balance": 2000,
  "low_count_threshold": 10,
  "last_refreshed_at": "2025-11-23T09:00:01.860Z",
  "auto_topup": {
    "credit_count": 32,
    "amount_excluding_tax": null,
    "price_id": null
  },
  "created_at": "2025-10-12T07:00:01.860Z",
  "updated_at": "2025-10-13T10:00:01.860Z"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

id
string
required

Body

application/json

Create credit payload

product_id
string
required

Credit product ID.

Example:

"itm_3kXODDF42QXtnL"

name
string

Credit name.

Example:

"Credit name"

current_balance
number

Current credit balance.

Example:

2000

low_count_threshold
number | null

Value indicating a low threshold.

Example:

10

auto_topup
object

Auto top-up options.

Response

201 - application/json

Credit created

product_id
string
required

Credit product ID.

Example:

"itm_3kXODDF42QXtnL"

customer_id
string
required

Customer ID related to the credit.

Example:

"cus_Typ0px2W0aiEtl"

name
string
required

Credit name.

Example:

"Credit name"

current_balance
number
required

Current credit balance.

Example:

2000

low_count_threshold
number | null
required

Value indicating a low threshold.

Example:

10

last_refreshed_at
string<date-time>
required

Credit last refresh date. UTC date time string in the ISO 8601 format.

Example:

"2025-11-23T09:00:01.860Z"

auto_topup
object | null
required

Auto top-up options.

created_at
string<date-time>
required

Credit creation date. UTC date time string in the ISO 8601 format.

Example:

"2025-10-12T07:00:01.860Z"

updated_at
string<date-time>
required

Credit last edition date. UTC date time string in the ISO 8601 format.

Example:

"2025-10-13T10:00:01.860Z"